import numpy as np
import random
idx=np.array([0,1,2,3])
x=np.array([random.random() for c in idx])
y=np.array([c*0.2 for c in idx])
def sort_by_x(idx,x,y):
	# print(idx,x,y)
	data=np.stack([idx,x,y],axis=1)
	# print(data)
	data = data[data[:, 1].argsort()]
	# print(data)
	idx=data[ :,0]
	x=data[ :,1]
	y=data[ :,2]
	return idx,x,y
print(idx,x,y)
[idx,x,y]=sort_by_x(idx,x,y)
print(idx,x,y)